import * as Type from './type'
import axios from 'axios'
const changeDetail = (res) => ({
  type: Type.GET_DETAIL,
  title: res.title,
  content: res.content
})

export const getDetail = (id)=> {
  return (dispatch) => {
    axios.get('/api/detail.json?id='+id).then( res => {
      console.log(res)
      dispatch(changeDetail(res.data.data))
    })
  }
}